package com.qidian.mes.sys.controller;

import com.qidian.mes.pojo.DictItem;
import com.qidian.mes.sys.annotations.OptionLogAnno;
import com.qidian.mes.sys.service.DictItemService;
import com.qidian.mes.util.dot.PagerDTO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 戴着假发的程序员
 * @Company 起点编程
 * @Description
 * @Time 2024/4/2 10:42
 */
@CrossOrigin
@RestController
@RequestMapping("/dictItem")
@OptionLogAnno(module = "字典项")
public class DictItemController {
    @Autowired
    private DictItemService dictItemService;
    @RequestMapping("/deletes")
    @OptionLogAnno(module = "批量删除")
    public QdResult deletes(Long [] dictItemId) {
        return dictItemService.deletes(dictItemId);
    }
    @RequestMapping("/delete")
    public QdResult delete(Long dictItemId) {
        return dictItemService.delete(dictItemId);
    }
    @RequestMapping("/update")
    public QdResult updateDict(@RequestBody DictItem dictItem) {
        return dictItemService.updateDict(dictItem);
    }
    @RequestMapping("/save")
    public QdResult saveDict(@RequestBody DictItem dictItem) {
        return dictItemService.saveDict(dictItem);
    }
    @RequestMapping("/queryById")
    public QdResult<DictItem> queryById(Long dictItemId) {
        return dictItemService.queryById(dictItemId);
    }
    @RequestMapping("/queryByPage")
    public QdResult<PagerDTO<DictItem>> queryByPage(DictItem dictItem, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int limit) {
        return dictItemService.queryByPage(dictItem, page, limit);
    }
}
